#ifndef _INPUT_H_
#define _INPUT_H_

/////// input.h //////////////////////////////////////////////////////////
//    Author:        Richard (richard.lindholm85@gmail.com)             //
//    Project:    some game project                                     //
//    Purpose:    Input class, for all sort of input to the game        //
//////////////////////////////////////////////////////////////////////////

#define DIRECTINPUT_VERSION 0x0800

//#include <Xinput.h>
#include <dinput.h>

#pragma comment(lib, "dinput8.lib")
#pragma comment(lib, "dxguid.lib")

struct MousePosition
{
    MousePosition(int x, int y, int z) :
        xPos(x), yPos(y), zPos(z) {}
    MousePosition() { xPos = yPos = zPos = 0; }
    int xPos,
        yPos,
        zPos;
};

class cInput
{
public:
    cInput(HWND hWnd, HINSTANCE hInsance);
    ~cInput() {}

    void updateInput();
    void updateKeyboard();
    void updateMouse();

    // Keyboard functions
    bool isKeyDown(DWORD keyID);
    bool isKeyUp(DWORD keyID);
    bool hasKeyBeenPushed(DWORD keyID);

    // Mouse functions
    bool isMouseKeyDown(int buttonID);
    bool isMouseKeyUp(int buttonID);
    bool hasMouseKeyBeenPushed(int buttonID);

    int getMouseX();
    int getMouseY();
    int getMouseZ();

private:
    //PXINPUT_KEYSTROKE m_xKeystroke;

     HWND m_hWnd;

    IDirectInput8 *m_lpDirectInput;
    IDirectInputDevice8 *m_lpKeyboard;
    IDirectInputDevice8 *m_lpMouse;

    unsigned char m_ucKeyState[256];
    unsigned char m_ucPrevKeyState[256];
    
    MousePosition m_mousePosition;
    DIMOUSESTATE m_mouseState;
    DIMOUSESTATE m_prevMouseState;

}

#endif